
let op =['dge','dle','eq']

function getParams(data = {},config = {}){

    let params = []

    Object.keys(config).forEach(key=>{

        config[key].forEach(value => {

            if(value.indexOf('time') > 0 || value.indexOf('date') > 0 ){

                let s_t = {
                    field: key +  '.' + value,
                    op: op[0],
                    value: data[key + '_' + op[0] + '_' + value]
                }

                let s_e = {
                    field: key +  '.' + value,
                    op: op[1],
                    value: data[key + '_' + op[1] + '_' + value]
                }

                if(data[key + '_' + op[0] + '_' + value]){
                    params.push(s_t)
                }

                if(data[key + '_' + op[1] + '_' + value]){
                    params.push(s_e)
                }

            }else{

                let s = {
                    field: key +  '.' + value,
                    op: op[2],
                    value: data[key + '_' + op[2] + '_' + value]
                }
                if(data[key + '_' + op[2] + '_' + value]){
                    params.push(s)
                }
            }
        })
    })

    return params
}


